/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package entity;

import util.InterfaceUtente;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author grillo
 */
@Entity
@Table(name = "studente")
@NamedQueries({@NamedQuery(name = "Studente.findAll", query = "SELECT s FROM Studente s"), @NamedQuery(name = "Studente.findByMatricola", query = "SELECT s FROM Studente s WHERE s.matricola = :matricola"), @NamedQuery(name = "Studente.findByNome", query = "SELECT s FROM Studente s WHERE s.nome = :nome"), @NamedQuery(name = "Studente.findByCognome", query = "SELECT s FROM Studente s WHERE s.cognome = :cognome"), @NamedQuery(name = "Studente.login", query = "SELECT u FROM Studente u WHERE u.matricola = :matricola AND u.password = :password"), @NamedQuery(name = "Studente.findByIndirizzo", query = "SELECT s FROM Studente s WHERE s.indirizzo = :indirizzo"), @NamedQuery(name = "Studente.findByMail", query = "SELECT s FROM Studente s WHERE s.mail = :mail"), @NamedQuery(name = "Studente.findByVotomaturita", query = "SELECT s FROM Studente s WHERE s.votomaturita = :votomaturita"), @NamedQuery(name = "Studente.findByTipomaturita", query = "SELECT s FROM Studente s WHERE s.tipomaturita = :tipomaturita"), @NamedQuery(name = "Studente.findByImmatricolazione", query = "SELECT s FROM Studente s WHERE s.immatricolazione = :immatricolazione"), @NamedQuery(name = "Studente.findByImg", query = "SELECT s FROM Studente s WHERE s.img = :img")})
public class Studente implements Serializable, InterfaceUtente {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "matricola")
    private Integer matricola;
    @Basic(optional = false)
    @Column(name = "nome")
    private String nome;
    @Basic(optional = false)
    @Column(name = "cognome")
    private String cognome;
    @Basic(optional = false)
    @Column(name = "password")
    private String password;
    @Column(name = "indirizzo")
    private String indirizzo;
    @Column(name = "mail")
    private String mail;
    @Column(name = "votomaturita")
    private Integer votomaturita;
    @Column(name = "tipomaturita")
    private String tipomaturita;
    @Column(name = "immatricolazione")
    @Temporal(TemporalType.TIMESTAMP)
    private Date immatricolazione;
    @Column(name = "img")
    private String img;
    @JoinColumn(name = "idcorso", referencedColumnName = "idcorso")
    @ManyToOne(optional = false)
    private CorsoStudio idcorso;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "studente")
    private List<PianoStudio> pianoStudioCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "studente")
    private List<PagamentoTasse> pagamentoTasseCollection;

    public Studente() {
    }

    public Studente(Integer matricola) {
        this.matricola = matricola;
    }

    public Studente(Integer matricola, String nome, String cognome, String password) {
        this.matricola = matricola;
        this.nome = nome;
        this.cognome = cognome;
        this.password = password;
    }

    public Integer getMatricola() {
        return matricola;
    }

    public void setMatricola(Integer matricola) {
        this.matricola = matricola;
    }

    public String getNome() {
        return nome;
    }

    public void setNome(String nome) {
        this.nome = nome;
    }

    public String getCognome() {
        return cognome;
    }

    public void setCognome(String cognome) {
        this.cognome = cognome;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getIndirizzo() {
        return indirizzo;
    }

    public void setIndirizzo(String indirizzo) {
        this.indirizzo = indirizzo;
    }

    public String getMail() {
        return mail;
    }

    public void setMail(String mail) {
        this.mail = mail;
    }

    public Integer getVotomaturita() {
        return votomaturita;
    }

    public void setVotomaturita(Integer votomaturita) {
        this.votomaturita = votomaturita;
    }

    public String getTipomaturita() {
        return tipomaturita;
    }

    public void setTipomaturita(String tipomaturita) {
        this.tipomaturita = tipomaturita;
    }

    public Date getImmatricolazione() {
        return immatricolazione;
    }

    public void setImmatricolazione(Date immatricolazione) {
        this.immatricolazione = immatricolazione;
    }

    public String getImg() {
        return img;
    }

    public void setImg(String img) {
        this.img = img;
    }

    public CorsoStudio getIdcorso() {
        return idcorso;
    }

    public void setIdcorso(CorsoStudio idcorso) {
        this.idcorso = idcorso;
    }

    public List<PianoStudio> getPianoStudioCollection() {
        return pianoStudioCollection;
    }

    public void setPianoStudioCollection(List<PianoStudio> pianoStudioCollection) {
        this.pianoStudioCollection = pianoStudioCollection;
    }

    public List<PagamentoTasse> getPagamentoTasseCollection() {
        return pagamentoTasseCollection;
    }

    public void setPagamentoTasseCollection(List<PagamentoTasse> pagamentoTasseCollection) {
        this.pagamentoTasseCollection = pagamentoTasseCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (matricola != null ? matricola.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Studente)) {
            return false;
        }
        Studente other = (Studente) object;
        if ((this.matricola == null && other.matricola != null) || (this.matricola != null && !this.matricola.equals(other.matricola))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.Studente[matricola=" + matricola + "]";
    }

}
